home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / c / fopen.man < prev    next >
Encoding:
Text File  |  1990-08-25  |  3.5 KB  |  133 lines

  1.  
  2.  
  3.  
  4. FOPEN                 C Library Procedures                  FOPEN
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      fopen, freopen, fdopen - open a stream
  10.  
  11. SSYYNNOOPPSSIISS
  12.      ##iinncclluuddee <<ssttddiioo..hh>>
  13.  
  14.      FFIILLEE **ffooppeenn((ffiilleennaammee,, ttyyppee))
  15.      cchhaarr **ffiilleennaammee,, **ttyyppee;;
  16.  
  17.      FFIILLEE **ffrreeooppeenn((ffiilleennaammee,, ttyyppee,, ssttrreeaamm))
  18.      cchhaarr **ffiilleennaammee,, **ttyyppee;;
  19.      FFIILLEE **ssttrreeaamm;;
  20.  
  21.      FFIILLEE **ffddooppeenn((ffiillddeess,, ttyyppee))
  22.      cchhaarr **ttyyppee;;
  23.  
  24. DDEESSCCRRIIPPTTIIOONN
  25.      _F_o_p_e_n opens the file named by _f_i_l_e_n_a_m_e and associates a
  26.      stream with it.  _F_o_p_e_n returns a pointer to be used to iden-
  27.      tify the stream in subsequent operations.
  28.  
  29.      _T_y_p_e is a character string having one of the following
  30.      values:
  31.  
  32.      "r"  open for reading
  33.  
  34.      "w"  create for writing
  35.  
  36.      "a"  append: open for writing at end of file, or create for
  37.           writing
  38.  
  39.      In addition, each _t_y_p_e may be followed by a "+" to have the
  40.      file opened for reading and writing.  "r+" positions the
  41.      stream at the beginning of the file, "w+" creates or trun-
  42.      cates it, and "a+" positions it at the end.  Both reads and
  43.      writes may be used on read/write streams, with the limita-
  44.      tion that an _f_s_e_e_k, _r_e_w_i_n_d, or reading an end-of-file must
  45.      be used between a read and a write or vice-versa.
  46.  
  47.      _F_r_e_o_p_e_n substitutes the named file in place of the open
  48.      _s_t_r_e_a_m.  It returns the original value of _s_t_r_e_a_m.  The ori-
  49.      ginal stream is closed.
  50.  
  51.      _F_r_e_o_p_e_n is typically used to attach the preopened constant
  52.      names, ssttddiinn,, ssttddoouutt,, ssttddeerrrr,, to specified files.
  53.  
  54.      _F_d_o_p_e_n associates a stream with a file descriptor obtained
  55.      from _o_p_e_n, _d_u_p, _c_r_e_a_t, or _p_i_p_e(2).  The _t_y_p_e of the stream
  56.      must agree with the mode of the open file.
  57.  
  58. SSEEEE AALLSSOO
  59.      open(2), fclose(3), fileno(3)
  60.  
  61.  
  62.  
  63. Sprite v1.0               May 27, 1986                          1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. FOPEN                 C Library Procedures                  FOPEN
  71.  
  72.  
  73.  
  74. DDIIAAGGNNOOSSTTIICCSS
  75.      _F_o_p_e_n and _f_r_e_o_p_e_n return the pointer NNUULLLL if _f_i_l_e_n_a_m_e cannot
  76.      be accessed, if too many files are already open, or if other
  77.      resources needed cannot be allocated.
  78.  
  79. BBUUGGSS
  80.      _F_d_o_p_e_n is not portable to systems other than UNIX.
  81.  
  82.      The read/write _t_y_p_e_s do not exist on all systems.  Those
  83.      systems without read/write modes will probably treat the
  84.      _t_y_p_e as if the "+" was not present.  These are unreliable in
  85.      any event.
  86.  
  87.      In order to support the same number of open files as does
  88.      the system, _f_o_p_e_n must allocate additional memory for data
  89.      structures using _c_a_l_l_o_c after 20 files have been opened.
  90.      This confuses some programs which use their own memory allo-
  91.      cators.  An undocumented routine, _f__p_r_e_a_l_l_o_c, may be called
  92.      to force immediate allocation of all internal memory except
  93.      for buffers.
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129. Sprite v1.0               May 27, 1986                          2
  130.  
  131.  
  132.  
  133.